<?php
class LineItem extends AppModel {

	var $name = 'LineItem';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Product' => array(
			'className' => 'Product',
			'foreignKey' => 'product_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Order' => array(
                        'className' => 'Order',
                        'foreignKey' => 'order_id',
                        'conditions' => '',
                        'fields' => '',
                        'order' => ''
        )
	);
    static function for_product($product){
                $item = array();
                $item['quantity'] = 1;
                $item['product_id'] = $product['id'];  # 2009/10/21 追加
                $item['product'] = $product;
                $item['unit_price'] = $product['price'];
                return $item;
   }
}
?>